package com.zyx.concurrentdemo.mytest.c03;

import lombok.extern.slf4j.Slf4j;

import static com.zyx.concurrentdemo.c02basic.util.Sleeper.sleep;

/**
 * @author Yaxi.Zhang
 * @since 2021/10/13 10:55
 */
@Slf4j(topic = "c.MakeTeaDemo")
public class MakeTeaDdemo {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            Thread current = Thread.currentThread();
            log.debug("{}洗水壶", current.getName());
            sleep(1);
            log.debug("{}烧开水", current.getName());
            sleep(15);
        }, "老王");


        Thread t2 = new Thread(() -> {
            Thread current = Thread.currentThread();
            log.debug("{}洗茶壶", current.getName());
            sleep(1);
            log.debug("{}洗茶杯", current.getName());
            sleep(2);
            log.debug("{}拿茶叶", current.getName());
            sleep(1);
            try {
                t1.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.debug("{}泡茶", current.getName());
        }, "小陈");

        t1.start();
        t2.start();

    }
}
